package org.zsl.mqdemo;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class RabbitConnectionUtil {

     public static Connection getConnection() throws IOException, TimeoutException {

         ConnectionFactory factory = new ConnectionFactory();

         factory.setHost("localhost");
         factory.setUsername("guest");
         factory.setPassword("guest");

         Connection connection = factory.newConnection();

         return  connection;

     }
}
